package com.session01.pm.game;

public class Monster {
    String name;
    int hp;
    int attack;
    int defence;

    public void response(Hero h) {
        System.out.println(this.name + "魅惑" + h.name);
        h.injured(this);
    }

    public void injured(Hero h) {
        int lostLife = h.attack - this.defence;
/*        if (lostLife <= 1) {
            lostLife = 1;
        }*/
        this.hp -= lostLife;
        System.out.println(this.name + "受到" + lostLife + "点伤害,剩余血量:" + this.hp);
    }
}
